//
//  ProjectDataBaseCell.m
//  YellowBridge
//
//  Created by 王右 on 2018/12/3.
//  Copyright © 2018 王右. All rights reserved.
//

#import "ProjectDataBaseCell.h"
#import "ProjectListModel.h"


@interface ProjectDataBaseCell ()

@property (weak, nonatomic) IBOutlet UIView *containerView;

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *projectCategory;

@property (weak, nonatomic) IBOutlet UILabel *projectStyle;

@property (weak, nonatomic) IBOutlet UILabel *projectSize;

@property (weak, nonatomic) IBOutlet UIImageView *projectStatusImageView;

@property (weak, nonatomic) IBOutlet UILabel *planInvesmentMoney;

@end


@implementation ProjectDataBaseCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _containerView.layer.cornerRadius = 2;
    _containerView.layer.masksToBounds = YES;
    _containerView.layer.borderColor = [UIColor colorWithHexString:@"#EAEBEC"].CGColor;
    _containerView.layer.borderWidth = 0.5f;
}


- (void)setModel:(ProjectListModel *)model{
    if (model) {
        _model = model;
        
        _nameLabel.text = model.projectname;
        switch (model.pmtype.intValue) {
            case 1:
                _projectCategory.text = @"市政道路";
                break;
            case 2:
                _projectCategory.text = @"居住建筑";
                break;
            case 3:
                _projectCategory.text = @"公共配套";
                break;
            default:
                _projectCategory.text = @"其他";
                break;
        }
        
        switch (model.pmxz.intValue) {
            case 1:
                _projectStyle.text = @"新建项目";
                break;
            case 2:
                _projectStyle.text = @"扩建项目";
                break;
            default:
                _projectStyle.text = @"改建项目";
                break;
        }
        
        if ([model.pmgm isEqualToString:@"A"]) {
            _projectSize.text = @"大型";
        }else if ([model.pmgm isEqualToString:@"B"]){
            _projectSize.text = @"中型";
        }else{
            _projectSize.text = @"小型";
        }
        
        
        _projectStatusImageView.hidden = [model.pmstatus isEqualToString:@"1"];
        
        if (model.pmjhztz.floatValue > 10000) {
            _planInvesmentMoney.text = [NSString stringWithFormat:@"%.2f万元",model.pmjhztz.floatValue / 10000];
        }else{
            _planInvesmentMoney.text = model.pmjhztz;
        }
        
        
    }
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
